home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung CD 2 (Tewi)(1994).iso
/
doc
/
netbios
/
netbios.doc
Wrap
Text File
|
1989-08-15
|
79KB
|
2,835 lines
## ## ####### ######## ###### #### ## ######
### ## ## ## ## ## ## ## ## ## ##
#### ## ## ## ## ## ## ## ## ##
## ## ## ##### ## ###### ## ## ## ######
## #### ## ## ## ## ## ## ## ##
## ### ## ## ## ## ## ## ## ## ##
## ## ####### ## ###### #### ## #####
CBIS Net Bios
Programmer's Reference
by Tom Thompson
April 1988
CBIS,Inc.
5875 Peachtree Industrial Blvd.
Bldg. 100 Suite 170
Norcross, GA 30092
Copyright (c) 1988 by CBIS, Inc. All rights reserved. No part
of this publication may be reproduced without the prior written
permission of CBIS, Inc., P.O. Box 921206, Norcross, GA 30092.
CBIS, Inc. makes no representations or warranties with respect to
the contents hereof and specifically disclaims any warranties
either expressed or implied of merchantability or fitness for any
particular purpose. CBIS, Inc. reserves the right to change this
publication and the software programs to which it relates with no
obligation to notify any person or organization of such changes.
ii
Abstract
Net BIOS is a software interface between computer programs and a
Local Area Network Adapter (LANA), or "LAN card". It is used in
Local Area Network (LAN) systems consisting of IBM compatible
microcomputers. The components of a LAN are the computers, each
containing a LAN card, the interconnect cables, and the Net BIOS
software. Net BIOS has been implemented for a variety of LAN
card types. These include Token Ring, Ethernet and ARCNET.
Application programs on different computers can communicate by
using Net BIOS services to send and receive messages.
The purpose of the Net BIOS is to isolate the application program
from the actual type of hardware used in the LAN. It also spares
the application programmer the details of network error recovery
and low level message addressing or routing.
In a Net BIOS implementation of a LAN, the computers on the
system are known by names. Each computer has a permanent name
that is programmed onto the LAN card. Computers on the system
can also be known by names designated by the programmer. The
commands available in Net BIOS include commands to add and delete
names.
Computers on a Net BIOS implementation of a LAN can communicate
either by establishing a session or by using datagram or
broadcast methods. Sessions allow a larger message to be sent
and handle error detection and recovery but they only allow
computers to communicate on a one-to-one basis. Datagram
and broadcast methods allow one computer to communicate with
several other computers at the same time, but are limited in
message size. Datagram and broadcast methods of communication do
no handle error detection and recovery. Net BIOS session control
commands and session data transfer commands allow communication
through sessions. Net BIOS datagram commands allow communication
without the use of sessions.
All commands are presented to the Net BIOS in a format called
Network Control Blocks (NCB). These blocks are allocated in
memory by the user program. The user program is also responsible
for setting the neccessary input fields of the NCB and
initializing the fields not used to zeros. Several fields in the
NCB are reserved for output from Net BIOS upon completion of a
command.
This manual discusses names and data communication methods in a
Net BIOS implementation of a LAN. Discussions of NCBs and Net
BIOS commands include descriptions of all the fields in an NCB and
all Net BIOS commands. Each Net BIOS command description lists
the NCB fields that are used for input or output for that
command. NCB and command information is summarized in the
Appendices at the end of the manual.
iii
TABLE OF CONTENTS
Introduction . . . . . . . . . . . . . . . . . . 1
Chapter 1
General Information . . . . . . . . . . . . 2
Net BIOS Names . . . . . . . . . . . . 2
Types of Data Transfer . . . . . . . . 3
Data Transfer Example . . . . . . . . 3
Calling Net BIOS . . . . . . . . . . . 3
Net BIOS Command Modes . . . . . . . . 4
Chapter 2
Communication with Net BIOS . . . . . . . . 5
Wait Mode . . . . . . . . . . . . . . 5
No-Wait Polling Mode . . . . . . . . . 5
No-Wait with Post Mode . . . . . . . . 6
Chapter 3
Network Control Block Format . . . . . . . 7
Assembly Language NCB Structure . . . . . . 9
Chapter 4
Net BIOS Commands . . . . . . . . . . . . . 10
General Commands . . . . . . . . . . . 11
Reset Command . . . . . . . . . . 11
Cancel Command . . . . . . . . . 12
Adapter Status Command . . . . . 13
Unlink Command . . . . . . . . . 16
Name Commands . . . . . . . . . . . . 17
Add Name Command . . . . . . . . 17
Add Group Name Command . . . . . 18
Delete Name Command . . . . . . . 19
Session Control Commands . . . . . . . 20
Call Command . . . . . . . . . . 20
Listen Command . . . . . . . . . 21
Hangup Command . . . . . . . . . 22
Session Status Command . . . . . 23
Session Data Transfer Command . . . . 25
Send Command . . . . . . . . . . 26
Chain Send Command . . . . . . . 27
Receive Command . . . . . . . . . 28
Receive Any Command . . . . . . . 29
Datagram Commands . . . . . . . . . . 30
Send Datagram Command . . . . . . 30
Receive Datagram Command . . . . 31
Send Broadcast Command . . . . . 32
Receive Broadcast Command . . . . 33
iv
TABLE OF CONTENTS (Cont.)
Appendix A
Net BIOS Command Summary . . . . . . . . . A-1
Appendix B
Net BIOS Control Block Format . . . . . . B-1
NCB Field Input/Output Summary . . . . . . B-2
Appendix C
Net BIOS Error Code Listing . . . . . . . C-1
List of Tables
1 - Adapter Status Result Buffer . . . . . . 14
2 - Session Status Result Buffer . . . . . . 24
v
Introduction
This manual describes the commands and command formats that are
used in the Net BIOS software interface. Net BIOS is an
interface standard for computer to computer communication in a
Local Area Network. The manual assumes the reader is familiar
with 8086 Assembly language, however, no prior experience with
Net BIOS is required.
Chapter 1 gives a general overview of Net BIOS concepts. It
defines and states the purpose of Net BIOS. Computers in a Net
BIOS implementation are known on a Local Area Network by names.
This section explains the concepts concerning names. Computers
on a network communicate by session or by datagram methods.
The advantages of each of these methods of communication are
discussed. This chapter includes a list of the steps that must
be taken in order for two computers to communicate through a
session. Use of Net BIOS through the Network Control Block
format and the concept of wait and no-wait command modes is
introduced.
Chapter 2 gives more detailed information about wait and no
wait command modes and lists the general steps necessary to pass
a Net BIOS command from a user program to Net BIOS for
execution.
Chapter 3 lists and describes the 14 fields in a Network Control
Block. This chapter includes an example of an assembly language
NCB structure.
Chapter 4 describes each of the available Net BIOS commands in
detail and lists the Network Control Blocks that are used for
each command. Each command description specifies which fields
must be set by the user program and which fields are returned by
Net BIOS after execution of the command.
Finally, Appendices A and B include tabular summaries of the
information presented in the text concerning Net BIOS commands and
Network Control Blocks.
Appendix C contains a listing of the error codes that may be
encountered while using the Net BIOS.
1
Chapter 1 General Information
Net BIOS is a software interface between computer programs and a
Local Area Network Adapter (LANA), or "LAN card". It is used in
Local Area Network (LAN) systems consisting of IBM compatible
microcomputers. The components of a LAN are the computers, each
containing a LAN card, the interconnect cables, and the Net BIOS
software. Net BIOS has been implemented for a variety of LAN
card types. These include Token Ring, Ethernet and ARCNET.
Application programs on different computers can communicate by
using Net BIOS services to send and receive messages.
The purpose of the Net BIOS is to isolate the application program
from the actual type of hardware used in the LAN. It also spares
the application programmer the details of network error recovery
and low level message addressing or routing.
Net Bios Names
Each computer on the network is known and addressed by the other
computers on the network by a name. Each computer has a
permanent name and can be given additional names by the user
during network communication. Names are 16 characters long and
should not contain the asterisk (*) character.
The permanent name is called the node number. The node
number is usually in ROM (read only memory) on the
LAN adapter card or is set by dip switches on the LAN adapter
card. The node number consists of 10 characters of binary zeros
followed by 6 more characters which must be unique on the
network.
Up to 16 local names may be added to the Net Bios for each
computer on the network by the use of the ADD NAME and ADD GROUP
NAME commands. These names are stored in a local name
table and are lost when the computer is turned off, or when the
Net BIOS RESET command is issued. A local name can be removed
from the local name table by use of the Net BIOS DELETE NAME
command.
The local names may be unique names or group names. A unique name
is guaranteed by the Net BIOS to be unique across the LAN. A
group name added at one computer may also be added, as a group
name, at other computers.
Data transfer commands must specify both a source and a
destination name. Since multiple names are allowed on
each computer, several unrelated tasks may use the Net BIOS
without interference.
2
Types of data transfer
Data can be transferred from computer to computer by using
session level or datagram level commands of the Net BIOS.
Session level commands allow user programs to communicate without
requiring that they handle the details of network error detection
or breaking larger messages into smaller messages to match any
physical network limitations. Session level commands are
restricted to communication from one unique name to another. Before
using session level data transfer, the applications must
negotiate a "logical connection". This is accomplished by
issuing a Net BIOS CALL command on one computer and a Net BIOS
LISTEN command on another computer.
Datagram level data transfers are addressed to a lower level in
the LAN adapter card. The intialization requirements for sending
or receiving a datagram message are simpler, however, more of the
error control and data formatting problems are left to the user
program. Datagrams are also restricted in the size of messages
to 512 bytes or less. Datagrams are useful for performing
functions not possible at the session level. For example, a
datagram message can be "broadcast" to more than one computer on
the network at the same time.
Data Transfer Example
A session level data transfer sequence can be grouped into four
steps. Each step on one computer in the network must have a
complementary step performed on another computer in the network.
(1) Add a unique name to the Net BIOS local name table
using the ADD NAME command.
(2) Initiate a session by using the CALL or LISTEN command.
If using a CALL, then another computer should have
performed a LISTEN.
(3) Transfer messages using the SEND and RECEIVE commands.
(4) Terminate the session with the HANGUP command.
Calling Net BIOS
Net BIOS commands are communicated to Net BIOS in the form of a
Network Control Blocks (NCBs). The user program is responsible
for allocating space for and creating NCBs. An NCB contains several
fields. Some fields are used to pass input values to Net BIOS
while others are used by Net BIOS to return results from the
command execution. The NCB fields include a command code field
and a command result field.
3
After creating an NCB, it is passed to the Net BIOS by loading
the address (segment:offset) of the NCB into the ES:BX registers,
and then executing a software Interrupt 5C hex. The Net BIOS
will perform the operation specified by the command code field in
the NCB.
Net Bios Command Modes
Three command modes are available when executing a Net BIOS
command:
- Wait mode
- No-wait mode with completion post routine
- No-wait mode with polling
In the wait mode, the Net BIOS will perform the command before
returning to the calling program. The AL register will have the
result of the operation. The no-wait modes may queue the command
for later execution and return program control to the user
program immediately. The user program can determine when the
command has been completed by testing a flag in the NCB
(polling) or by specifying the address of a "post" subroutine to
be called when the command completes.
4
Chapter 2 Communicating with Net Bios
Commands are issued to the Net BIOS in the following manner:
- Allocate and initialize an NCB
- Load the ES:BX registers with the address of the NCB
- Execute an INT 5Ch instruction
Two fields in the NCB determine the command mode, these are the
high-order bit of the COMMAND field and the POST field. The
command field is an 8 bit code that specifies the desired action.
The POST address is a double word pointer to a user routine to be
called when the command is completed, or 0:0 to indicate no user
routine. The valid combinations are:
High-Order Bit Post Field Mode
0 don't care Wait
1 0:0 No-wait polling
1 address of No-wait with post
post routine
Wait Mode
When a wait mode command is issued, the Net BIOS will not return
control to the user program until the command has been completed.
Upon return, the AL register will contain 0 if no error occurred
or an error code value. The AH register contents are destroyed,
but other registers are not changed. The error code in AL is the
same as that contained in the NCB RETCODE field.
No-Wait Polling Mode
The Net Bios will, after minimum processing, return immediately,
even though the command may not have completed. On return, the
AL register will contain an immediate error code or 0.
Contents AL Indicates
not 0 Command could not be queued
(e.g., invalid COMMAND code).
0 Command was queued
If the command was queued successfully then the program should
poll the CMD_DONE field of the NCB, until CMD_DONE field is not
0ffh. This indicates that the command has completed and all
other NCB fields are valid. The AH register contents are
destroyed, but other registers are not changed.
è
5
No-Wait With Post Mode
The Net Bios will return immediately, even though the command may
not have completed. On return, the AL register will contain an
immediate error code or 0.
Contents AL Indicates
not 0 Command could not be queued
(e.g., invalid COMMAND code).
0 Command was queued
If the command could not be queued, the POST routine will not be
called. The AH register contents are destroyed, and other
registers are not changed.
If the command was queued, then when the command completes, the
Net BIOS will call the user's POST routine with interrupts
disabled, the stack set for an IRET, and ES:BX containing the
address of the completed NCB.
Another Net BIOS command can be issued from the POST routine,
however, it should also be a no-wait mode command.
The user POST routine should be as short as possible and no
registers should be changed. Interrupts may be enabled in the
POST routine.
In some cases, the user's POST routine will be called before
control is returned from the INT 5Ch that started the command.
6
Chapter 3 Network Control Block Format
Net BIOS commands must conform to a Network Control Block (NCB)
format. Network Control Blocks (NCBs) are 64 bytes in length and
consist of 14 different fields. All fields in a NCB should be
initialized to zero. The fields used in a command should then be
set. Results of the command are communicated through the NCB. A
description of each field in the NCB format follows.
FIELD DESCRIPTION
COMMAND A 1 byte field used for the Net Bios command code. The
high order bit of this field should be set to 1 to
indicate no-wait mode or 0 to indicate wait mode. The
remaining 7 bits are used for the command code. All
Net BIOS commands except RESET and CANCEL have wait and
no-wait options. In no-wait mode the POST field must
also be set. In wait mode the Net BIOS waits for the
command to complete before returning to the calling
program. In the no-wait mode the Net BIOS queues the
command for later execution and then returns to the
calling program, which may perform other processing or
issue additional Net BIOS commands.
RETCODE A 1 byte field in which Net BIOS command results are
returned. This field will contain a zero if no error
or an error code if an error was encountered. The
error codes are listed in Appendix C.
LSN A 1 byte field containing the local session number that
is assigned by Net BIOS when a session is established.
This number will have a value between 1 and 254. This
field is returned by CALL and LISTEN, and must be
supplied for SEND and RECEIVE commands.
NUM A 1 byte field used for the name number associated with
the name in the local name table. This number is
returned by ADD NAME commands and must be supplied for
RECEIVE ANY and datagram commands. The value of this
number ranges from 1 to 254.
BUFADR A 4 byte field used for the address of message to be
sent or received.
BUFLEN A 2 byte field containing the length in bytes of
message buffer. For receive commands, this field is set
to the maximum buffer size and the actual length is
returned in this field upon completion of the Net BIOS
command.
7
CALLNAME A 16 byte field used to indicate the name of the
computer you want to communicate with for CALL, LISTEN
and datagrams. For a CHAIN SEND command, the first
word specifies the length of the second buffer, and the
next two words specify the address. All 16 bytes must
be used.
NAME A 16 byte field used to specify a local name.
Specifies a name to add to the local name table for ADD
NAME, or the name to use for other commands.
RTO A 1 byte field used for receive time-out specifications
in .5 second increments. Must be set for CALL and
LISTEN commands. This field indicates the maximum time
that will be allowed before an error condition will
result on a receive command. Once the session is
established this value remains constant throughout the
session.
STO A 1 byte field used for send time-out specifications in
.5 second increments. This field must be set for CALL
and LISTEN commands. If the time expires before the
send has completed a time out error will result and the
session will be terminated.
POST Address of user interrupt routine called when command
completes and no-wait mode mode was specified in
command code. Not called if set to 0:0.
LANA_NUM A 1 byte field that contains the number of the adapter
card to be addressed by the command. It there are two
adapter cards installed on the same computer then a 0
in this field signifies that the command is addressing
the first card and a 1 indicates that the command is
addressing the second card. If there is only one
adapter card in the computer then this field should
contain a 0.
CMD_DONE A 1 byte field that is set by Net BIOS when a command
is completed. A value of 0FFH indicates the command
has not completed. When the command has completed,
CMD_DONE is set to same value as RETCODE.
RES A 14 byte field used internally by Net Bios. Should not
be used for any other purposes.
8
Assembly Language NCB Structure
Shown below is an example of an NCB defined in an assembly
language program.
NCB struc
ncb_command db ? ;command code
ncb_retcode db ? ;err ret code
ncb_lsn db ? ;session number
ncb_num db ? ;name number
ncb_bufadr dd ? ;ptr to send/recv data
ncb_buflen dw ? ;len of data
ncb_callname db 16 dup (?) ;remote name
ncb_name db 16 dup (?) ;local name
ncb_rto db ? ;recv timeout
ncb_sto db ? ;send timeout
ncb_post dd ? ;async cmd complete post addr
ncb_lana_num db ? ;adapter number
ncb_cmd_done db ? ;0ffh until command completed
ncb_res db 14 dup (?) ;reserved
NCB ends
9
Chapter 4 Net BIOS Command Descriptions
Net BIOS commands can be grouped into five classes. These are
- General
- Name
- Session Control
- Session Data Transfer
- Datagram
General commands include commands to reset Net BIOS and specify
the number of sessions and NCBs to be supported, or to determine
the status of the Net BIOS.
Session Control commands are used to initiate or terminate
communication between two computers on the network, or to
access the status information on a particular session.
Session Data Transfer commands are used to send or receive
messages between computers once the session has been established.
Datagram commands are used to send and receive messages at a
lower level in the LAN system. These messages are restricted in
size but can be sent to and received from more than one computer
at a time.
The commands available in each group are described below. For
each command, the required NCB fields are listed. Although not
absolutely required, it is good practice to initialize unused
fields to zero in new NCBs. It is generally not necessary to
clear unused fields when re-using an NCB for another command.
For example, a completed LISTEN command returns the name of the
caller in the CALLNAME field. It is not necessary to clear this
field before using the same NCB for a RECEIVE command.
10
General Commands
The general commands are
- Reset
- Cancel
- Adapter Status
- Unlink
These commands can be used to reset Net BIOS and specify the
number of sessions and NCBs to be supported, to cancel previous
commands, to determine the status of the Net BIOS, or to unlink
from diskless boot.
Reset Command
Use this command to clear and configure the Net Bios.
Caution: When this command is issued, all existing names and
sessions are lost, therefore it should be issued before
starting any processes that use the Net Bios.
Caution: In some implementations, session and command buffers
take space otherwise used for packet buffers.
Therefore, keep these parameters reasonable.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 032h (Wait mode), No-wait mode not available
LANA_NUM Specifies which LANA the command is addressing
LSN Number of sessions to be supported
Possible values between 1 and 32
NUM Number of commands (NCBs) outstanding at one time
Possible values between 1 and 32
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
11
Cancel Command
Use this command to cancel a previous command.
Caution: If this command is used with a SEND or CHAIN SEND
command the session will be terminated.
The following commands cannot be canceled:
RESET DELETE NAME
CANCEL SESSION STATUS
ADD NAME SEND DATAGRAM
ADD GROUP NAME SEND BROADCAST
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 035h (Wait mode), No-wait mode not available
LANA_NUM Specifies which LANA the command is addressing
BUFADR Address of the NCB for the previous command.
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
12
Adapter Status Command
Use this command to get the status of a Net Bios -- either
local or remote.
The format of the Adapter Status Result buffer is shown in Table 1.
The actual size of the status buffer will be 60 + 18n, where n is
the number of names in the name table of the selected Net Bios
(the permanent node name is not counted).
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 033h (Wait mode), 0B3h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
CALLNAME Use asterisk as first character to refer to local Net BIOS
Use 15 character name to refer to remote Net BIOS
BUFADR Starting address of status report buffer
BUFLEN Size of status report buffer, 348 bytes maximum
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
BUFLEN Actual size of status report buffer
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
13
Table 1
Adapter Status Result Buffer
^U Offset Bytes Field Description
___(Hex) (Dec)________________________________________________
0 6 Permanent node name. This six byte identifier
is obtained from either a ROM on the LAN card
or from the node address DIP switch.
6 1 External jumper status. The high bit of this
byte indicates the interrupt number used by
the LAN card -- 0 for IRQ 2 and 1 for IRQ 3.
The second highest bit indicates the DMA chan-
nel used by the LAN card -- 0 for channel 1
and 1 for channel 3. This byte is not sup-
ported in all implementations.
7 1 Power on test result. Always zero in current
versions.
8 2 Software version. First byte is the major
version, second is the minor version number.
0A 2 Minutes since system started. When this field
reaches 0FFFFH, it rolls over to 0.
0C 2 Number of CRC errors on received packets. (1)
0E 2 Number of alignment errors. (1)
10 2 Number of transmit collisions. (1)
12 2 Number of aborted transmits. (1)
14 4 Number of packets transmitted. When this
field reaches 0FFFFFFFFH, it rolls over to 0.
18 4 Number of packets received. When this field
reaches 0FFFFFFFFH, it rolls over to 0.
1C 2 Number of retransmits. (1)
1E 2 Number of times receiver was out of buffers.
(1)
20 8 Not used -- reserved.
(Continued Next Page)
14
Table 1 (Continued)
Adapter Status Result Buffer
Offset Bytes Field Description
___(Hex) (Dec)________________________________________________
28 2 Number of free network command blocks (NCBs).
(2)
2A 2 Number of NCBs specified in last RESET command.
2C 2 Maximum possible number of NCBs that can be
specified in RESET command.
2E 4 Not used -- reserved.
32 2 Number of pending or active sessions.
34 2 Number of possible sessions specified in last
RESET command.
36 2 Maximum number of possible sessions that can
be specified in RESET command.
38 2 Maximum packet size supported on the network.
Note, this is not related to the maximum
session message size, which is 64K bytes.
3A 2 Number of names in name table.
3C 18 First name in name table. (3)
* 16 bytes - name
* 1 byte - name number (2 to 254)
* 1 byte - name status. Bit patterns are:
* G----000 - name add in progress
* G----100 - active name
* G----101 - delete pending
* G----110 - improper duplicate name
* G----111 - duplicate name, delete
pending
4E X18 Addition name table entries as needed.
Notes
1 These fields will not increment further after reaching
0FFFFH.
2 In some implementations, there is no limit on the number of
NCBs pending, so an arbitrary large number is used in these
fields.
3 The permanent name (name number 1) does not appear in the
name table.
è
15
Unlink Command
Use this command to cancel diskless boot redirection. Typically,
a diskless boot ROM makes a connection with a process that
supplies a virtual floppy image and redirects INT 13 requests for
drive A to this network device. This command cancels that
redirection so that the local drive A may be accessed.
Caution: Once this command is issued, there is no way to
re-establish the diskless boot connection.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 070h (Wait mode), No-wait mode not available
LANA_NUM Specifies which LANA the command is addressing
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
16
NAME COMMANDS
Name commands allow the addition and deletion of local and group
names for a computer on the network. The name commands are:
- Add name
- Add group name
- Delete name
Following is a description of the name commands and the NCB
fields that are used for these commands.
Add Name Command
Use this command to add a name to the Net Bios local name table.
The name must be unique across the network.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 030h (Wait mode), 0B0h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NAME 16 Character name . . .
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
NUM Name number, if successful, between 1 and 254
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
17
Add Group Name Command
Use this command to add a non-unique name to the Net Bios local name
table. It the name already exists as a unique name by any other
process or machine an error code will be returned in the RETCODE
field and the name will not be added to the local name table.
Group names provide a mechanism to "broadcast" messages to a
specific group of computers on the system. SEND DATAGRAM to a
group name will be received by all computers that have issued a
RECEIVE DATAGRAM under the group name.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 036h (Wait mode), 0B6h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NAME 16 Character name . . .
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
NUM Name number, if successful, between 1 and 254
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
18
Delete Name Command
Use this command to delete a name from the Net Bios local name table.
If no sessions are active under the name to be deleted, the name
will be deleted. If any sessions are active, then the command
will not complete until these sessions are terminated.
Caution: Any of the following commands outstanding and
associated with the deleted command will be terminated
with RETCODE = 17h (name was deleted):
LISTEN RECEIVE ANY
RECEIVE DATAGRAM RECEIVE
BROADCAST
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 031h (Wait mode), 0B1h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NAME 16 Character name . . .
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE 17h If name was deleted
CMD_DONE FF Until command done
19
SESSION CONTROL COMMANDS
Session control commands are used to initiate or terminate
communication between two computers on the network, or to
access the status information on a particular session.
Session control commands are:
- Call
- Listen
- Hang up
- Session Status
The commands available in this group are described below. For
each command, the required NCB fields are listed.
Call Command
This command is used to establish a session with another machine
or process.
A LISTEN command must be outstanding for the called (remote)
name. The session number is used when sending or receiving
session data, or in the HANG UP (session terminate) command.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 010h (Wait mode), 090h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
CALLNAME Remote name
NAME Local name
RTO Receive timeout
STO Send timeout
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
LSN Session number, when successful, between 1 and 254
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
20
Listen Command
Use this command to wait for a session to be established.
The session will be established when another machine or process
executes a CALL to the name associated with the LISTEN command.
More than one session can be established under the same name, or
same pair of names.
PRIORITY: Regardless of order in which the LISTENs are issued,
a CALL received from a specific name when there is a LISTEN
pending with a matching CALLNAME will take precedence over a
LISTEN for any name (* in first character) command.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 011h (Wait mode), 091h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NAME Local name under which session will be established.
CALLNAME Name of the caller,
If '*' is the first character, accept call from any name.
RTO Receive timeout
STO Send timeout
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
LSN Session number, between 1 and 254
This number is used when sending or receiving
session data, or in the HANG UP (session terminate) command.
CALLNAME Contains caller's name if '*' was used as input
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
21
Hang Up Command
Use this command to close or terminate a session. It may be
issued by either the CALLer or LISTENer.
If any RECEIVE commands for the session are outstanding on the
machine issuing the HANG UP, they are completed with RETCODE =
0Ah (session closed).
If SEND commands are outstanding, the HANG UP completion will be
delayed until the SEND has completed.
If the remote end has any RECEIVE or SEND commands in progress
when HANG UP is started, they will be terminated with
RETCODE = 0Ah.
If no remote RECEIVEs or SENDs are terminated with session
closed, and if RECEIVE ANY commands are outstanding at the
remote, one and only one of the RECEIVE ANYs will be terminated
with the session closed error.
If no commands are outstanding at the remote machine when the
HANG UP occurs, then the next session command issued by the
remote will be terminated RETCODE set to either 08h (invalid
session) or 0Ah (session closed).
NCB FIELDS USED:
FIELD DESCRIPTION
COMMAND 012h (Wait mode), 092h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
LSN Session number of the session to be closed.
POST
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
22
Session Status Command
Use this command to obtain the status of all sessions associated
with a given name. Table 2 on the following page shows the
format of the status.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 034h (Wait mode), 0B4h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NAME Name for which status desired
BUFADR Address of buffer to receive status report
BUFLEN Length of buffer (at least 4)
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE 06h, If message incomplete, buffer not large enough
00, If no error
BUFLEN Actual size of buffer
CMD_DONE FF until command done
23
Table 2
Session Status Result Buffer
Offset Byte Size Field Description
(Hex) (Dec)
0 1 Sessions' name number.
1 1 Number of sessions under name.
2 1 Number of RECEIVE DATAGRAM and RECEIVE
BROADCAST commands outstanding.
3 1 Number of RECEIVE ANY commands outstanding.
(4) (36) Session status - first session (if at least 1).
4 1 * Local session number (LSN).
5 1 * Session state
1: LISTEN pending 4: HANG UP pending
2: CALL pending 5: HANG UP complete
3: Active 6: Session aborted
6 16 * Local name (NAME)
16 16 * Remote name (CALLNAME)
26 1 * Number of RECEIVE commands outstanding
27 1 * Number of SEND and CHAIN SEND commands
outstanding
28 X36 Session status for additional sessions as
needed
24
SESSION DATA TRANSFER COMMANDS
Session Data Transfer commands are used to send or receive
messages between computers once the session has been established.
Session data transfer commands are:
- Send
- Chain Send
- Receive
- Receive Any
Once a session is established, the Net Bios maintains tables that
allow the process to specify the remote computer for data transfer
with a session number. Send and receive commands use this
session number for data transmission. In addition, a "receive
any" command allows a process to receive messages from any of the
sessions it has established.
The commands available in this group are described below. For
each command, the required NCB fields are listed.
25
Send Command
Use this command to send data to the machine or process with which a
session as been established. The remote session must have issued
(or issue before the time-out specified earlier in STO) a RECEIVE
or RECEIVE ANY command.
Priority: SENDs are performed in the order in which they are
issued.
Caution: If an error occurs on the send, then the session is
terminated.
NCB FIELDS USED:
FIELD DESCRIPTION
COMMAND 014h (Wait mode), 094h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
LSN Session number
BUFADR Start address of buffer
BUFLEN Length of buffer
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
26
Chain Send Command
The CHAIN SEND command is similar to the SEND command, except the
data to be transferred is contained in two separate buffers.
CHAIN send concatenates these buffers -- the receiving end will
see one message.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 017h (Wait mode), 097h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
BUFADR Address of first buffer
BUFLEN Length of first buffer
CALLNAME+2 Address of second buffer
CALLNAME+0 Length of second buffer
LSN Local session number
POST Used in no-wait mode only,
Contains address of post routine or 0:0
The total length of both buffers cannot exceed 65535 bytes.
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
27
Receive Command
Use this command to receive data from a computer or process with
which a session as been established. The remote session must
issue a SEND or CHAIN SEND command.
If a send is not issued by the remote within the time specified
earlier in RTO, the RECEIVE will complete with a time out error
(RETCODE = 05h). Time outs do not cause session termination.
PRIORITY: RECEIVE commands are completed in the order in which
they are issued. If received data could be used to complete
either a RECEIVE or RECEIVE ANY, the RECEIVE is given priority
and completed.
If the maximum buffer length was smaller than the length of the
data, then the buffer is filled to the maximum and RETCODE = 06h
is returned. The next RECEIVE (or RECEIVE ANY) will be completed
with the remainder of the data.
NCB FIELDS USED:
FIELD DESCRIPTION
COMMAND 015h (Wait mode), 095h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
LSN Session number
BUFADR Address of buffer
BUFLEN Maximum length of receive data buffer.
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
BUFLEN Actual size of the received data
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
28
Receive Any Command
Use this command to receive data from any session. The remote
session must issue a SEND or CHAIN SEND command. There is no
time-out on this command.
PRIORITY: RECEIVE ANY commands are completed in the order in
which they are issued. If received data could be used to
complete either a RECEIVE or RECEIVE ANY, the RECEIVE is given
priority and completed.
If the maximum buffer length was smaller than the length of the
data, then the buffer is filled to the maximum and RETCODE = 06h
is returned. The next RECEIVE ANY (or RECEIVE) will be completed
with the remainder of the data.
RECEIVE ANY is used by a process that services multiple users.
Session termination by the local or remote process will cause the
next pending RECEIVE ANY to complete with RETCODE = 0Ah (session
terminated) or 18h (session terminated abnormally).
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 016h (Wait mode), 096h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NUM Name number of allowable sessions,
or 0FFh to receive for any session under any name.
BUFADR Address of the receive data buffer
BUFLEN Maximum length of the receive data buffer
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
LSN Local session number of a completed receive
BUFLEN Actual size of the received data
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
29
DATAGRAM COMMANDS
Datagrams provide a means to transfer data between
processes without using the session mechanism. Messages may be
sent to a given name, a group name, or to all processes.
Datagram messages do not provide the same reliability as session data
transfer, since the sender will not be notified when messages are
undeliverable.
Datagram commands are:
- Send Datagram
- Receive Datagram
- Send Broadcast
- Receive Broadcast
These commands are described below. For each command, the
required NCB fields are listed.
Send Datagram Command
Use this command to send a datagram message. The Net Bios
does not detect whether the message was successfully
delivered.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 020h (Wait mode), 0A0h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NUM Local name number
CALLNAME Destination name (may be a group name.)
BUFADR Address
BUFLEN Length of the message. 512 bytes maximum
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
30
Receive Datagram Command
Use this command to wait for a SEND DATAGRAM to the name associated
with the NUM field. There is no time-out on this command. If
the maximum buffer length was smaller than the length of the
data, then the buffer is filled to the maximum and RETCODE = 06h
is returned. The remaining data is lost.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 021h (Wait mode), 0A1h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
BUFADR Address of receive data buffer
BUFLEN Maximum length of receive data buffer
NUM Name, may be a group name
or 0FFh to receive all datagrams to the machine.
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
CALLNAME The name of the sender
BUFLEN The actual size of the received data
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
31
Send Broadcast Command
Use this command to send a broadcast message. The Net Bios
does not detect whether the message was successfully
delivered.
Each SEND BROADCAST satisfies all outstanding RECEIVE BROADCAST
commands on the network.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 022h (Wait mode), 0A2h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NUM Local name number
BUFADR Address of buffer
BUFLEN Length of the message, 512 bytes maximum
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
32
Receive Broadcast Command
Use this command to wait for a SEND BROADCAST message. There is no
time-out on this command.
Each SEND BROADCAST satisfies all outstanding RECEIVE BROADCAST
commands on the network.
If the maximum buffer length was smaller than the length of the
data, then the buffer is filled to the maximum and RETCODE = 06h
is returned. The remaining data is lost.
NCB FIELDS SET:
FIELD DESCRIPTION
COMMAND 023h (Wait mode), 0A3h (No-wait mode)
LANA_NUM Specifies which LANA the command is addressing
NUM Valid name number
BUFADR Address of receive data buffer
BUFLEN Size of receive data buffer
POST Used in no-wait mode only,
Contains address of post routine or 0:0
NCB FIELDS RETURNED:
FIELD DESCRIPTION
CALLNAME Name of the sender
BUFLEN Actual size of the received data
RETCODE Error code or 0 if no error.
CMD_DONE FF until command done
33
APPENDIX A
Net Bios Command Summary
Command Wait No Wait
Name Code Code Description
General Commands
RESET 32 -- Reset Net Bios.
CANCEL 35 -- Cancel a pending command.
ADAPTER STATUS 33 B3 Get status of a Net Bios.
UNLINK 70 -- Cancel boot redirection.
Name Commands
ADD NAME 30 B0 Add unique name to name table.
ADD GROUP NAME 36 B6 Add non-unique name to table.
DELETE NAME 31 B1 Delete name from name table.
Session Control Commands
CALL 10 90 Establish session with another.
LISTEN 11 91 Wait for a CALL from another.
HANG UP 12 92 Close session.
SESSION STATUS 34 B4 Status of sessions under name.
Session Data Transfer Commands
SEND 14 94 Send session data.
CHAIN SEND 17 97 Concatenate and send two buffers.
RECEIVE 15 95 Receive session data.
RECEIVE ANY 16 96 Receive data from any session
under specified name.
Datagram Commands
SEND DATAGRAM 20 A0 Send data, addressed by name.
RECEIVE DATAGRAM 21 A1 Receive datagram to name.
SEND BROADCAST 22 A2 Send data to all stations.
RECEIVE BROADCAST 23 A3 Enable receive of next broadcast.
A-1
APPENDIX B
Net Bios Control Block (NCB) Format
Off- Size Field
set Bytes Name Field Description
(Hex) (Dec)
0 1 COMMAND Net Bios command code. High order bit
set indicates no-wait mode.
1 1 RETCODE Completion result. Zero if no error.
2 1 LSN Local session number (1 to 254). Returned
by CALL and LISTEN, and supplied for
SEND and RECEIVE commands.
3 1 NUM Name Number (1 to 254). Returned by ADD
NAME commands, and supplied for RECEIVE
ANY and datagram commands.
4 4 BUFADR Address of message for send and receive.
8 2 BUFLEN Length of message buffer. For receive
commands, supply the maximum buffer size
and the actual length is returned.
0A 16 CALLNAME Name from/of remote machine for CALL,
LISTEN and datagrams. For a CHAIN SEND
command, the first word specifies the
length of the second buffer, and the
next two words specify the address.
1A 16 NAME Local name. Specifies name to add for ADD
NAME, or name to use for other commands.
2A 1 RTO Receive time-out in .5 second increments.
Supplied on CALL and LISTEN commands.
2B 1 STO Send time-out in .5 second increments.
Supplied on CALL and LISTEN commands.
2C 4 POST Address of user interrupt routine called
when command completes and no-wait mode
mode was specified in command code. Not
called if set to 0:0.
30 1 LANA_NUM Number of adapter card -- 0 for the first
and 1 for the second, if applicable.
31 1 CMD_DONE Command completed flag. A value of 0FFH
indicates the command has not completed.
When the command has completed, CMD_DONE
is set to same value as RETCODE.
32 14 RES Used internally by Net Bios. è
B-1
NCB Field Input/Output Summary
=================================================================
| | C | R | L | N | B | B | C | N | R | P | L | C |
| | O | E | S | U | U | U | A | A | T | O | A | M |
| | M | T | N | M | F | F | L | M | O | S | N | D |
| | M | C | | | A | L | L | E | & | T | A | _ |
| | A | O | | | D | E | N | | S | | _ | D |
| | N | D | | | R | N | A | | T | | N | O |
| | D | E | | | | | M | | O | | U | N |
| | | | | | | | E | | | | M | E |
| | | | | | | | | | | | | |
| Command | | | | |BUF|BUF|CAL| |RTO| |LAN|CMD|
| Name |CMD|RET|LSN|NUM|ADR|LEN|NAM|NAM|STO|PST|NUM|DON|
=================================================================
|RESET | I | O | I | I | - | - | - | - | - | - | I | O |
|CANCEL | I | O | - | - | I | - | - | - | - | - | I | O |
|ADAPTER STATUS | I | O | - | - | I |I/O| I | - | - | I | I | O |
|UNLINK | I | O | - | - | - | - | - | - | - | - | I | O |
=================================================================
|ADD NAME | I | O | - | O | - | - | - | I | - | I | I | O |
|ADD GROUP NAME | I | O | - | O | - | - | - | I | - | I | I | O |
|DELETE NAME | I | O | - | - | - | - | - | I | - | I | I | O |
=================================================================
|CALL | I | O | O | - | - | - | I | I | I | I | I | O |
|LISTEN | I | O | O | - | - | - |I/O| I | I | I | I | O |
|HANG UP | I | O | I | - | - | - | - | - | - | I | I | O |
|SESSION STATUS | I | O | - | - | I |I/O| - | I | - | I | I | O |
=================================================================
|SEND | I | O | I | - | I | I | - | - | - | I | I | O |
|CHAIN SEND | I | O | I | - | I | I | I | - | - | I | I | O |
|RECEIVE | I | O | I | - | I |I/O| - | - | - | I | I | O |
|RECEIVE ANY | I | O | O | I | I |I/O| - | - | - | I | I | O |
=================================================================
|SEND DATAGRAM | I | O | - | I | I | I | I | - | - | I | I | O |
|RECV DATAGRAM | I | O | - | I | I |I/O| O | - | - | I | I | O |
|SEND BROADCAST | I | O | - | I | I | I | - | - | - | I | I | O |
|RECV BROADCAST | I | O | - | I | I |I/O| O | - | - | I | I | O |
=================================================================
Legend
I = Field is input (passed to Net Bios)
O = Field is output (returned by Net Bios)
I/O = Field is used for both input and output
B-2
APPENDIX C
NET BIOS ERROR CODE LISTING
Code Description
00 No error.
01 Illegal buffer length. A SEND BROADCAST or SEND
DATAGRAM command specified a length greater than 512
bytes, or a status command specified a buffer length
smaller than minimum allowed.
03 Invalid command.
05 Time out. For SEND, RECEIVE, and HANG UP commands, the
time-out specified when the session was established has
elapsed. For a CALL or ADAPTER STATUS command, an
internal timer expired.
06 Message Incomplete. The buffer size specified in the
NCB was not large enough to hold the receive data. For
RECEIVE or RECEIVE ANY commands, the next command will
get the rest of the data. For other commands, the
remaining data is lost.
08 Invalid local session number (LSN).
09 Out of resources. The Net Bios is out of some internal
resource, such as buffers. Delay and reissue the
command.
0A Session closed. For a SEND, RECEIVE, RECEIVE ANY, or
HANG UP, this indicates that the session was terminated
by the remote computer.
0B Command canceled. Command execution of the NCB was
aborted by the CANCEL command.
0D Duplicate local name. An ADD NAME command specified
an existing name.
0E Name table full.
0F DELETE NAME completed, but name has active sessions
(name will be deleted when all sessions closed).
11 Local session table full.
12 Remote computer not listening. On a CALL, the remote
computer was found, but had no outstanding LISTEN for
the CALL.
13 Invalid name number.
14 Name not found. è
C-1
NET BIOS ERROR CODE LISTING (cont.)
Code Description
15 Name not found or "*" or 00h in first byte of remote
name field on a CALL.
16 Name already exists on network.
17 Name was deleted.
18 Session terminated abnormally. Connection with the
remote computer was lost.
19 Name conflict. Two computers using the same name was
detected.
21 Interface busy. The Net Bios cannot execute because
it was called from an interrupt handler.
22 Too many commands issued.
23 Invalid LAN adapter (LANA) number.
24 Command completed before canceled. Returned in CANCEL
NCB when target command completed normally.
26 Invalid cancel command. The target NCB could not be
found.
40-FE Hardware error.
FF Indicates the command has not completed.
C-2